// education.js
Page({
    data: {
        educationList: []
    },
    onShow: function () {
        this.loadEducationList();
    },
    onLoad: function () {
        this.loadEducationList();
    },
    loadEducationList: function () {
        wx.getStorage({
            key: 'educationList',
            success: (res) => {
                console.log(res)
                this.setData({educationList: res.data});
            }
        })
    },
    navigateToForm: function () {
        wx.navigateTo({
            url: '/pages/resume/form/education/form/education-form'
        });
    },
    editEducation: function (e) {
        const index = e.currentTarget.dataset.index;
        // const education = this.data.educationList[index];
        wx.navigateTo({
            url: `/pages/resume/form/education/form/education-form?index=${index}`
        });
    },
    deleteEducation: function (e) {
        const index = e.currentTarget.dataset.index;
        const educationList = this.data.educationList;
        educationList.splice(index, 1);
        this.setData({educationList});
        wx.setStorageSync('educationList', educationList);
    }
});
